/*
 * @Author: f
 * @Date: 2023-01-29 10:19:50
 * @Description: file content
 * @LastEditors: f
 * @LastEditTime: 2023-02-17 11:01:33
 */
import type { Result, IPage } from './model/result'
import https, { ContentType, Method, RequestParams } from '@/utils/https'

import { SortVo, QueryBannersVo, GetBannersDto, IdsVo, IdVo, GetBannerByIdDto, SaveOrUpdateBannerVo, UpdSortVo } from './model/appBannerModel'

/** 查询banner列表   根据等于对象属性值**/
export const appBannerQueryBanners = (params: QueryBannersVo) => {
  return https().request<any, Result<IPage<GetBannersDto>>>({
    url: '/app/appBanner/QueryBanners',
    method: Method.POST,
    headers: { 'Content-Type': ContentType.json },
    data: params
  })
}
/** 查询banner列表(排序頁面使用)   根据等于对象属性值**/
export const appBannerQueryBannersForSort = (params: QueryBannersVo) => {
  return https().request<any, Result<GetBannersDto[]>>({
    url: '/app/appBanner/QueryBannersForSort',
    method: Method.POST,
    headers: { 'Content-Type': ContentType.json },
    data: params
  })
}
/** 根據id刪除banner信息   根据等于对象属性值返回**/
export const appBannerDelBannerById = (params: IdsVo) => {
  return https().request<any, Result<any>>({
    url: '/app/appBanner/delBannerById',
    method: Method.POST,
    headers: { 'Content-Type': ContentType.json },
    data: params
  })
}
/** 根據id獲取banner信息   根据等于对象属性值返回**/
export const appBannerGetBannerById = (params: IdVo) => {
  return https().request<any, Result<GetBannerByIdDto>>({
    url: '/app/appBanner/getBannerById',
    method: Method.POST,
    headers: { 'Content-Type': ContentType.json },
    data: params
  })
}
/** 保存   有id更新，无更新保存**/
export const appBannerSaveOrUpdate = (params: SaveOrUpdateBannerVo) => {
  return https().request<any, Result<any>>({
    url: '/app/appBanner/saveOrUpdate',
    method: Method.POST,
    headers: { 'Content-Type': ContentType.json },
    data: params
  })
}
/** 修改banner順序   根据id删除**/
export const appBannerUpdBannerSort = (params: UpdSortVo) => {
  return https().request<any, Result<any>>({
    url: '/app/appBanner/updBannerSort',
    method: Method.POST,
    headers: { 'Content-Type': ContentType.json },
    data: params
  })
}
